<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>KeyframeTrack - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
	<h1 translate="no">KeyframeTrack</h1>
		<section>
			<header>
				<div class="class-description"><p>Represents s a timed sequence of keyframes, which are composed of lists of
times and related values, and which are used to animate a specific property
of an object.</p></div>
			</header>
			<article>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="KeyframeTrack" translate="no">new <a href="#KeyframeTrack">KeyframeTrack</a><span class="signature">( name : <span class="param-type">string</span>, times : <span class="param-type">Array.&lt;number></span>, values : <span class="param-type">Array.&lt;(number|string|boolean)></span>, interpolation : <span class="param-type"><a href="global.html#InterpolateLinear">InterpolateLinear</a> | <a href="global.html#InterpolateDiscrete">InterpolateDiscrete</a> | <a href="global.html#InterpolateSmooth">InterpolateSmooth</a></span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Constructs a new keyframe track.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The keyframe track's name.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>times</strong>
									</td>
									<td class="description last">
										<p>A list of keyframe times.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>values</strong>
									</td>
									<td class="description last">
										<p>A list of keyframe values.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>interpolation</strong>
									</td>
									<td class="description last">
										<p>The interpolation type.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id="DefaultInterpolation" translate="no">.<a href="#DefaultInterpolation">DefaultInterpolation</a><span class="type-signature"> : <a href="global.html#InterpolateLinear">InterpolateLinear</a> | <a href="global.html#InterpolateDiscrete">InterpolateDiscrete</a> | <a href="global.html#InterpolateSmooth">InterpolateSmooth</a></span> </h3>
					<div class="description">
						<p>The default interpolation type of this keyframe track.</p>
						<p>Default is <code>InterpolateLinear</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="TimeBufferType" translate="no">.<a href="#TimeBufferType">TimeBufferType</a><span class="type-signature"> : TypedArray | Array</span> </h3>
					<div class="description">
						<p>The time buffer type of this keyframe track.</p>
						<p>Default is <code>Float32Array.constructor</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="ValueBufferType" translate="no">.<a href="#ValueBufferType">ValueBufferType</a><span class="type-signature"> : TypedArray | Array</span> </h3>
					<div class="description">
						<p>The value buffer type of this keyframe track.</p>
						<p>Default is <code>Float32Array.constructor</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="ValueTypeName" translate="no">.<a href="#ValueTypeName">ValueTypeName</a><span class="type-signature"> : String</span> </h3>
					<div class="description">
						<p>The value type name.</p>
						<p>Default is <code>''</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="name" translate="no">.<a href="#name">name</a><span class="type-signature"> : string</span> </h3>
					<div class="description">
						<p>The track's name can refer to morph targets or bones or
possibly other values within an animated object. See PropertyBinding#parseTrackName
for the forms of strings that can be parsed for property binding.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="times" translate="no">.<a href="#times">times</a><span class="type-signature"> : Float32Array</span> </h3>
					<div class="description">
						<p>The keyframe times.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="values" translate="no">.<a href="#values">values</a><span class="type-signature"> : Float32Array</span> </h3>
					<div class="description">
						<p>The keyframe values.</p>
					</div>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="InterpolantFactoryMethodDiscrete" translate="no">.<a href="#InterpolantFactoryMethodDiscrete">InterpolantFactoryMethodDiscrete</a><span class="signature">( result : <span class="param-type">TypedArray</span> )</span><span class="type-signature"> : <a href="DiscreteInterpolant.html">DiscreteInterpolant</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Factory method for creating a new discrete interpolant.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>result</strong>
									</td>
									<td class="description last">
										<p>The result buffer.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The new interpolant.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="InterpolantFactoryMethodLinear" translate="no">.<a href="#InterpolantFactoryMethodLinear">InterpolantFactoryMethodLinear</a><span class="signature">( result : <span class="param-type">TypedArray</span> )</span><span class="type-signature"> : <a href="LinearInterpolant.html">LinearInterpolant</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Factory method for creating a new linear interpolant.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>result</strong>
									</td>
									<td class="description last">
										<p>The result buffer.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The new interpolant.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="InterpolantFactoryMethodSmooth" translate="no">.<a href="#InterpolantFactoryMethodSmooth">InterpolantFactoryMethodSmooth</a><span class="signature">( result : <span class="param-type">TypedArray</span> )</span><span class="type-signature"> : <a href="CubicInterpolant.html">CubicInterpolant</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Factory method for creating a new smooth interpolant.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>result</strong>
									</td>
									<td class="description last">
										<p>The result buffer.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The new interpolant.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="KeyframeTrack.html">KeyframeTrack</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns a new keyframe track with copied values from this instance.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getInterpolation" translate="no">.<a href="#getInterpolation">getInterpolation</a><span class="signature">()</span><span class="type-signature"> : <a href="global.html#InterpolateLinear">InterpolateLinear</a> | <a href="global.html#InterpolateDiscrete">InterpolateDiscrete</a> | <a href="global.html#InterpolateSmooth">InterpolateSmooth</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the current interpolation type.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The interpolation type.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getValueSize" translate="no">.<a href="#getValueSize">getValueSize</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the value size.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The value size.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="optimize" translate="no">.<a href="#optimize">optimize</a><span class="signature">()</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Optimizes this keyframe track by removing equivalent sequential keys (which are
common in morph target sequences).</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this animation clip.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="scale" translate="no">.<a href="#scale">scale</a><span class="signature">( timeScale : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="KeyframeTrack.html">KeyframeTrack</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Scale all keyframe times by a factor (useful for frame - seconds conversions).</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>timeScale</strong>
									</td>
									<td class="description last">
										<p>The time scale.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this keyframe track.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setInterpolation" translate="no">.<a href="#setInterpolation">setInterpolation</a><span class="signature">( interpolation : <span class="param-type"><a href="global.html#InterpolateLinear">InterpolateLinear</a> | <a href="global.html#InterpolateDiscrete">InterpolateDiscrete</a> | <a href="global.html#InterpolateSmooth">InterpolateSmooth</a></span> )</span><span class="type-signature"> : <a href="KeyframeTrack.html">KeyframeTrack</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Defines the interpolation factor method for this keyframe track.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>interpolation</strong>
									</td>
									<td class="description last">
										<p>The interpolation type.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this keyframe track.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="shift" translate="no">.<a href="#shift">shift</a><span class="signature">( timeOffset : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="KeyframeTrack.html">KeyframeTrack</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Moves all keyframes either forward or backward in time.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>timeOffset</strong>
									</td>
									<td class="description last">
										<p>The offset to move the time values.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this keyframe track.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="trim" translate="no">.<a href="#trim">trim</a><span class="signature">( startTime : <span class="param-type">number</span>, endTime : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="KeyframeTrack.html">KeyframeTrack</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Removes keyframes before and after animation without changing any values within the defined time range.</p>
<p>Note: The method does not shift around keys to the start of the track time, because for interpolated
keys this will change their values</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>startTime</strong>
									</td>
									<td class="description last">
										<p>The start time.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>endTime</strong>
									</td>
									<td class="description last">
										<p>The end time.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this keyframe track.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="validate" translate="no">.<a href="#validate">validate</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
					<div class="method">
						<div class="description">
							<p>Performs minimal validation on the keyframe track. Returns <code>true</code> if the values
are valid.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> Whether the keyframes are valid or not.</dt>
						</dl>
					</div>
				<h2 class="subsection-title">Static Methods</h2>
					<h3 class="name name-method" id=".toJSON" translate="no">.<a href="#.toJSON">toJSON</a><span class="signature">( track : <span class="param-type"><a href="KeyframeTrack.html">KeyframeTrack</a></span> )</span><span class="type-signature"> : Object</span> </h3>
					<div class="method">
						<div class="description">
							<p>Converts the keyframe track to JSON.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>track</strong>
									</td>
									<td class="description last">
										<p>The keyframe track to serialize.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The serialized keyframe track as JSON.</dt>
						</dl>
					</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/src/animation/KeyframeTrack.js" translate="no" target="_blank" rel="noopener">src/animation/KeyframeTrack.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>